package org.spbsu.apco.server.service;

import org.springframework.stereotype.Service;
import org.spbsu.apco.server.system.Runner;
import org.spbsu.apco.server.system.SystemService;
import org.spbsu.apco.server.utility.JaxbList;

import javax.annotation.Resource;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

/**
 * User: mikpan
 * Date: 12/12/12
 * Time: 9:03 PM
 */
@Service
@Path("/system")
public class SystemServiceImpl {
    @Resource
    SystemService systemService;

    @PUT
    @Path("/new")
    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public void addRunner(Runner runner) {
        systemService.addRunner(runner);
    }

    @GET
    @Path("/all")
    @Produces(MediaType.APPLICATION_XML)
    public JaxbList<Runner> getRunners() {
        return new JaxbList<Runner>(systemService.getRunners());
    }
}